<%-- 
  -- Body List para resultado de busqueda de Honorarios.
  --
  -- TODO Hacer un link de aca a egreso de honorarios 
  -- 
  -- @author nicolas.gonzalez
--%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/displaytag-el.tld" prefix="display" %>
<%@ taglib uri="/WEB-INF/security.tld" prefix="security" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%-- Librerias para EXT library --%>
<link rel="stylesheet" type="text/css" href="<html:rewrite page='/protected/script/ext-1.1.1/resources/css/ext-all.css'/>" />
<link rel="stylesheet" type="text/css" href="<html:rewrite page='/protected/script/ext-1.1.1/resources/css/xtheme-default.css'/>" />

<script src="<html:rewrite page='/protected/script/ext-1.1.1/adapter/ext/ext-base.js'/>" type="text/javascript"></script>
<script src="<html:rewrite page='/protected/script/ext-1.1.1/ext-all.js'/>" type="text/javascript"></script>


<script type="text/javascript">
	/* Va a la pagina para registrar el pago
	 */
	var payHonorary = function(id) {
		$("honoraryIdPreparePayId").value = id;		
		
        var form = $("preparePayFormId");
        form.submit();
	}

</script>

<%-- El ID del form NO debe ser modificado. Se usa desde el menu --%>
<html:form action="/protected/findHonoraries.do" styleId="honoraryFormId">

    <h2>Honorarios encontrados</h2>
    
    <bean:define id="honoraries" name="honoraryForm" property="honoraries" />

    <display:table name="pageScope.honoraries" sort="list" export="true" pagesize="10" requestURI="/protected/findHonoraries.do" id="row" class="displayTable">
        
        <display:column title="Pagar" class="columnGifLink" media="html">
	        <logic:equal name="row" property="debtStatus" value="VIGENTE">
	            <img src="<html:rewrite page='/protected/img/money.gif'/>" alt="" name="submitButton" onclick="payHonorary('<bean:write name="row" property="id" />')" title="Paga el honorario...">
	        </logic:equal>
	        <logic:notEqual name="row" property="debtStatus" value="VIGENTE">
	            <img src="<html:rewrite page='/protected/img/file_locked.png'/>" alt="" name="submitButton" style="cursor: default" >
	        </logic:notEqual>
        </display:column>
        
        <display:column title="Docente" property="teacher.name" sortable="true" />
        
        <display:column title="Legajo" property="teacher.fileNumber" sortable="true" media="csv excel pdf"/>
        
        <display:column title="Curso" property="course.name" sortable="true" />
        <display:column title="Desde" property="validityFrom" sortable="true" format="{0,date,dd/MM/yyyy}"/>
        <display:column title="Importe" property="value" sortable="true" />
        <display:column title="Estado" property="debtStatus" sortable="true" decorator="ar.uba.fi.posgrado.common.web.util.PosgradoStatusDecorator" />
    </display:table>    

</html:form>

<%-- Inyectados por Javascript --%>
<div id="preparePayDivId" class="hideClass">
    <html:form action="/protected/preparePay" styleId="preparePayFormId">
        <html:hidden property="honoraryId" value="" styleId="honoraryIdPreparePayId" />
    </html:form>
</div>